<template>
  <div>
    <table-ext :columns="columns" :searchForm="searchForm" :config="config" ref="tableExt">
      <template slot="table-action">
        <!-- <el-button type="info" @click="addUserDialog">新增</el-button> -->
      </template>
    </table-ext>
  </div>

</template>
<script>
  import TableExt from '@/components/common/table-ext/table-ext.vue';
  export default {
    // 引入自定义表格组件
    components:{
      'table-ext': TableExt
    },
    data() {
      return {   
        config:{ // 页面共通配置
          title: '供应商转正申请列表', //页面标题
          isPage: true, //是否分页
          isNo: false, //是否显示序号
          selection: false, //是否显示复选框
          crudMapping:{ // CRUD方法
            query:{
              url: this.lib.config.host.vendorDlv+"/vendormgt/prompt/query",
            }
          }
        },   
         // 查询表单配置
        searchForm:[{
          //显示标签
          label: '采购组织', 
          //数据字段
          key: 'purOrgId', 
          //标签类型
          type: 'multipleSelect',
          dict: [{
            key: 'P1001',
            value: '苏州采购组织'
          },{
            key: 'P1002',
            value: '长沙采购组织'
          }]
        },{
          label: '采购组',
          key: 'purGroupId',
          type: 'multipleSelect',
          dict: [{
            key: 'G00001',
            value: '苏州采购组001'
          },{
            key: 'G00002',
            value: '苏州采购组002'
          }]
        },{
          label: '供应商编码',
          key: 'vendorCode',
          type: 'input'
        },{
          label: '供应商名称',
          key: 'title',
          type: 'vendorName'
        },{
          label: '供货品类',
          key: 'supplyCategoryCode',
          type: 'input'
        },{
          label: '申请人',
          key: 'applyerName',
          type: 'input',
        },{
          label: '审核状态',
          key: 'checkStatus',
          type: 'multipleSelect',
          dict: [
             {
            key: '0',
            value: '未审核'
          },
            {
            key: '1',
            value: '通过'
          },{
            key: '2',
            value: '驳回'
          }]
        }],
        
        columns:[{
          label: '采购组织',
          key: 'purOrgName',
          width:'160'
        },{
          label: '采购组织',
          key: 'purGroupName',
          width:'160'
        },
        { 
          label: '申请编号', // 表格header
          width:'160',
          render: (createElement, params) => { // 动态渲染，click事件示例
            let _this = this;
            return createElement('div', {}, [createElement('a', {
              style: {
                color: '#409EFF',
                cursor: 'pointer'
              },
                on: {
                  click() {
                    _this.vendorPrompt(params.row.id,params.row.vendorId,params.row.devApplyNo,params.row.description,params.row.supplyCategoryCode);
                  }
                }
              }, params.row.promptNo)
            ]);
          }
        },
        {
          label: '供应商编码',
          key: 'vendorCode',
          width:'160'
        },{
          label: '供应商名称',
          key: 'vendorName',
          width:'240'
        },{
          label: '供货品类',
          key: 'supplyCategoryName',
          width:'160'
        },{
          label: '申请人',
          key: 'applyerName',
           width:'160'
        },{
          label: '申请日期',
          key: 'publishTime',
           width:'160'
        },{
          label: '申请原因',
          key: 'description',
          width:'160'
        },{
          label: '审核状态',
          key: 'checkStatus',
          width:'120'
        },{
          label: 'SAP编码',
          key: 'erpVendorCode',
          width:'120'
        },{
          label: 'SAP返回消息',
          key: 'erpReturnMsg',
          width:'120'
        }]
      };
    },
    mounted() {
    },
    methods: {
      vendorPrompt(id,vendorId,devApplyNo,description,supplyCategoryCode){
         this.$router.push({
                        path: '/Index/VendorDlv/VendorPromptView',
                        query: {
                          promptId: id,
                          vendorId : vendorId,
                          devApplyNo : devApplyNo,
                          description : description,
                          categoryCode : supplyCategoryCode
                        }
                      })
        
      }
    }
  }
</script>
